package models


type SystemSubjectType struct {
	Id           int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
	SubjectId int `json:"subject_id" xorm:"not null comment('学科主键') INT(11)"`
	TypeId int `json:"type_id" xorm:"not null comment('题型主键')  INT(11)"`
}
var systemsubjecttype ="system_subject_type"

func(s *SystemSubjectType) GetRow() bool {
	has, err := mEngine.Get(s)
	if err==nil &&  has  {
		return true
	}
	return false
}

func(s *SystemSubjectType) GetSubjectIdsByTypeId(typeId int) ([]int,error) {
	var subjectIdArr []int

	err := mEngine.Table(systemsubjecttype).Cols("subject_id").Where("type_id = ?",typeId).Find(&subjectIdArr)

	return subjectIdArr,err
}


